Parent/Root action

back to section start!
 
  The user has clicked on the Parent or Root button, or used the keyboard 
shortcuts. 
 
  1doparentroot: 
  2  if arcsubdir = '' then do 
  3    cuthere = lastpos('/',arcfile) 
  4    if cuthere = 0 | upper(event) = 'ROOT' then 
  5      cuthere = pos(':',arcfile) 
  6    normaldir = left(arcfile,cuthere) 
  7    if qualifier = 'shift' then do 
  8      lister new normaldir 
  9      newhandle = result 
 10      lister wait newhandle 
 11      lister set newhandle source 
 12      end 
 13    else do 
 14      lister set handle title 
 15      lister read handle normaldir 
 16      end 
 17    end 
 18  else do 
 19    if upper(event) = 'ROOT' then 
 20      newsubdir = '' 
 21    else do 
 22      cuthere = lastpos('/',left(arcsubdir,length(arcsubdir) - 1)) 
 23      newsubdir = left(arcsubdir,cuthere) 
 24      end 
 25    if qualifier = 'shift' then do 
 26      lister new 
 27      newhandle = result 
 28      address command 'Copy >NIL: T:ArcDir.list'handle 'T:ArcDir.list'newhandle 
 29      lister set newhandle source 
 30      address command 'Run >NIL: <NIL: RX DOpus5:ARexx/ArcDir.dopus5 GETDIR' portname '"'arcfile'"' newhandle newsubdir 
 31      end 
 32    else do 
 33      arcsubdir = newsubdir 
 34      call arclist 
 35      end 
 36    end 
 37  return 
 
Line: 
 1      Sub-routine label. 
 2 - 17 If arcsubdir is empty, it means we're in the root directory of 
        the archive.  We then check to see if there is a '/' character 
        starting from the end of arcfile, (which is the name of our 
        archive with full path, for example - RAM:Foo/bar.lha), if there is 
        no '/' then we must be in the root of the device and we get the 
        position of the ':'.  normaldir is then set to the path where our 
        archive is, so if it was RAM:Foo/bar.lha normaldir will be RAM:Foo/. 
        If the shift key was held down we open a new lister and read the 
        path specified in normaldir, we get it's handle in 
        newhandle, wait until it's idle and set it's state to source. 
        If the shift key wasn't held down, we set the titlebar to the default 
        and read the directory into the lister which kills our handler. 
18      If arcsubdir wasn't empty we start here. 
19 - 20 If the event was ROOT then we set newsubdir to an empty string. 
21 - 24 Otherwise we find the second last occurrence of '/' and set 
        newsubdir to the path to the left of it, for example if 
        arcsubdir is RAM:foo/bar/who/ then newsubdir will 
        be RAM:foo/bar/. 
25 - 31 If the shift key was held down, we open a new lister, get it's 
        handle, copy the archive contents list to another file for the new 
        handler, set it to SOURCE then call ArcDir.dopus5 on it with the 
        command GETDIR, Opus' ARexx port name, archive filename, handle of 
        the new lister AND the path in newsubdir. 
32 - 35 The shift key wasn't held down, so we set arcsubdir to newsubdir and 
        call  arclist  to update the entry display in the lister. 
37      Return. 
 

DOpus PLUS - giving you that bit extra...